package com.jxs.easysecurity.session;

import java.util.Map;

/**
 * @author jiangxingshang
 * @since 17/6/21
 */
public class SessionWrapper {

    private Session session;
    private Map<String, Object> extras;

    SessionWrapper(Session session, Map<String, Object> extras) {
        this.session = session;
        this.extras = extras;
    }

    public Session getSession() {
        return session;
    }

    /**
     * @see LoginResult#getExtras()
     * @return
     */
    public Map<String, Object> getExtras() {
        return extras;
    }

    /**
     * @see LoginResult#getExtras()
     * @return
     */
    @SuppressWarnings("unchecked")
    public <T> T getExtra(String name) {
        return (T)extras.get(name);
    }
}
